import { IPage } from '../component/public/router';
import { IData } from '../component/pc/antd/menu_nav';
import Home from './home';
import Table from './table';
import TableInfo from './table/info';

/**
 * 导出页面
 */
export const page: IPage = {
  '/home': Home,
  '/table': Table,
  '/info': TableInfo,
};

/**
 * 导出导航
 */
export let nav: IData[] = [
  {
    to: '/home',
    title: '首页',
    icon: 'home',
  },
  {
    to: '/table',
    title: '表格页面',
    icon: 'table',
  },
  {
    to: '/info',
    title: '表单页面',
    icon: 'form',
  },
];

// 追加还原分页
nav = nav.map(i => {
  const { onClick } = i;
  i.onClick = () => {
    window.store.view.setKey('root', 1); // 还原分页
    onClick && onClick();
  };
  return i;
});
